
/**
 * Copyright (C) FPT - Aptech
 * TableDataModel.java - 2012 - khangpm
 */
package dto;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author khangpm
 */
public class TableDataModel extends AbstractTableModel{
    ArrayList data;
    ArrayList colHeader;
    public TableDataModel(ArrayList data,ArrayList colHeader) {
        this.data = data;
        this.colHeader = colHeader;
    }
    @Override
    public int getRowCount() {
        return data.size();
    }

    @Override
    public int getColumnCount() {
        return colHeader.size();
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        ArrayList temp = (ArrayList)data.get(rowIndex);
        return temp.get(columnIndex);
    }

    @Override
    public String getColumnName(int column) {
        return colHeader.get(column).toString();
    }
    
    

}
